<template>
  <view class="page">
    <view class="item" v-for="(item,index) in list" :key="item.pkgCode" @click="toDetail(item)">
      <view class="">
        <view class="title">
          {{item.pkgName}}
        </view>
        <view class="tig">
          适用性别：{{gender[item.gender]}}
        </view>
      </view>
      <view class="money">
        ¥{{ item.money }}
      </view>
    </view>
  </view>
</template>

<script>
  import {getPkgLs} from '@/api/physical.js'
  const gender = {
    M:'男性',
    MW:'已婚女性',
    UW:'未婚女性',
    W:'女性',
    C:'男女通用'
  }
  export default {
    data() {
      return {
        gender,
        list: []
      }
    },
    onLoad() {
      this.getPkgLs()
    },
    methods: {
      getPkgLs() {
        getPkgLs().then(res => {
          this.list = res
        })
      },
      toDetail(item) {
        uni.navigateTo({
          url: '../PackageDetail/PackageDetail?pkg=' + JSON.stringify(item),
        })
      }
    }
  }
</script>

<style scoped lang="less">
.page {
  // padding: 32upx;
  // height: 100vh;
}
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24upx 32upx;
  background-color: #FFF;
  border-radius: 8upx;
  margin-bottom: 32upx;
  .title {
    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 28upx;
    color: rgba(0,0,0,0.7);
    line-height: 44upx;
    margin-bottom: 10upx;
  }
  .tig {
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 24upx;
    color: rgba(0,0,0,0.29);
    line-height: 44upx;
  }
  .money {
    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 32upx;
    color: #FFAA32;
    line-height: 44upx;
  }
}
</style>
